<tagLib name="html" />
<script language="javascript" src="/Public/static/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<div id="main-content">
    <div id="main" class="main">
        <div class="spin-cont">
            <div class="user-hd">
                <h2>{$page_title}</h2>
            </div>
            <div class="clearfix searchspin searchorder">
                <p>
                    <form name="data_form" action="{:U('Analyse/financial')}" method="get">
                    <div class="fl">
						下单时间：
						<input type="text" name="create_time_start" id="create_time_start" placeholder="开始时间" value="{$create_time_start}" class="Wdate bg-input" onFocus="WdatePicker({maxDate:'#F{ $dp.$D(\'create_time_end\')||\'{$today}\'}'})" readonly="readonly" size="30" style="width: 90px;" />
						<input type="text" name="create_time_end" id="create_time_end" placeholder="结束时间" value="{$create_time_end}" class="Wdate bg-input mr5" onFocus="WdatePicker({minDate:'#F{ $dp.$D(\'create_time_start\')}',maxDate:'{$today}'})" readonly="readonly" size="30" style="width: 90px;" />
						{:w('Area/multLevel', array(1, '', 1, $area_1, $area_2, $area_3))}
						<input type="submit" class="sblue-btn" value="搜索" />
						<input type="button" onclick="clearFilter()" class="sblue-btn" value="清空" />
                    </div>
                    <div class="clear"></div>
                    </form>
                </p>
            </div>
            <div class="msg-cont" style="border: 0px; padding: 20px 0 20px 20px;">
                <div class="analyse_pie_box">
					<div class="chart_title">订单流水统计</div>
					<div class="chart" id="space_pie_1"></div>
					<div class="item_options">
						<div class="item">
							<label>流水总计：</label>
							<span>{$pay_money_total}元</span>
							<div class="clear"></div>
						</div>
						<div class="item">
							<label>会员卡支付：</label>
							<span>{$pay_money_4}元</span>
							<div class="clear"></div>
						</div>
						<div class="item">
							<label>券支付：</label>
							<span>{$pay_money_5}元</span>
							<div class="clear"></div>
						</div>
						<div class="item">
							<label>支付宝支付：</label>
							<span>{$pay_money_6}元</span>
							<div class="clear"></div>
						</div>
						<div class="item">
							<label>微信支付：</label>
							<span>{$pay_money_7}元</span>
							<div class="clear"></div>
						</div>
					</div>
				</div>
				<div class="analyse_pie_box" style="margin: 0 0px 0 0;">
					<div class="chart_title">退款流水统计</div>
					<div class="chart" id="space_pie_2"></div>
					<div class="item_options">
						<div class="item">
							<label>退款总计：</label>
							<span>{$refund_money_total}元</span>
							<div class="clear"></div>
						</div>
						<div class="item">
							<label>会员卡退款：</label>
							<span>{$refund_money_4}元</span>
							<div class="clear"></div>
						</div>
						<div class="item">
							<label>券退款：</label>
							<span>{$refund_money_5}元</span>
							<div class="clear"></div>
						</div>
						<div class="item">
							<label>支付宝退款：</label>
							<span>{$refund_money_6}元</span>
							<div class="clear"></div>
						</div>
						<div class="item">
							<label>微信退款：</label>
							<span>{$refund_money_7}元</span>
							<div class="clear"></div>
						</div>
					</div>
				</div>
				<div class="clear"></div>
				<div class="analyse_line_box" id="space_line_1"></div>
				<div class="clear"></div>
				<div class="analyse_bar_box" id="space_bar_1"></div>
				<div class="clear"></div>
            </div>
        </div>
    </div>
</div>
<script language="JavaScript" src="__PUBLIC__/static/echarts/echarts-all.js"></script>
<script>
//支付流水统计
space_option_1 = {
    title : {
        x:'center'
    },
    color:['#4F81BD','#C0504D', '#ff7f50', '#7b68ee'],
    legend: {
        orient : 'horizontal',
        x : 'center',
        y : 'bottom',
        selectedMode: false,
        data:['会员卡支付:{$pay_money_4}元','券支付:{$pay_money_5}元','支付宝支付:{$pay_money_6}元','微信支付:{$pay_money_7}元'],
        formatter:function(val){
            val = val.replace(/:[\d|\.]{0,10}元/, '');
            return val;
        }
    },
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    calculable : false,
    series : [
        {
            name:'支付流水统计',
            type:'pie',
            radius : '55%',
            center: ['50%', '45%'],
            data:[
                <if condition="0 EQ $pay_money_total">
                    {value:1, name:'暂无数据'}
                <else/>
                    {value:{$pay_money_4}, name:'会员卡支付:{$pay_money_4}元'},
                    {value:{$pay_money_5}, name:'券支付:{$pay_money_5}元'},
                    {value:{$pay_money_6}, name:'支付宝支付:{$pay_money_6}元'},
                    {value:{$pay_money_7}, name:'微信支付:{$pay_money_7}元'},
                </if>
            ]
        }
    ]
};
echarts.init(document.getElementById('space_pie_1')).setOption(space_option_1);

//退款流水统计
space_option_2 = {
    title : {
        x:'center'
    },
    color:['#4F81BD','#C0504D', '#ff7f50', '#7b68ee'],
    legend: {
        orient : 'horizontal',
        x : 'center',
        y : 'bottom',
        selectedMode: false,
		data:['会员卡退款:{$refund_money_4}元','券退款:{$refund_money_5}元','支付宝退款:{$refund_money_6}元','微信退款:{$refund_money_7}元'],
        formatter:function(val){
            val = val.replace(/:[\d|\.]{0,10}元/, '');
            return val;
        }
    },
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    calculable : false,
    series : [
        {
            name:'退款流水统计',
            type:'pie',
            radius : '55%',
            center: ['50%', '45%'],
            data:[
                <if condition="0 EQ $refund_money_total">
                    {value:1, name:'暂无数据'}
                <else/>
                    {value:{$refund_money_4}, name:'会员卡退款:{$refund_money_4}元'},
                    {value:{$refund_money_5}, name:'券退款:{$refund_money_5}元'},
                    {value:{$refund_money_6}, name:'支付宝退款:{$refund_money_6}元'},
                    {value:{$refund_money_7}, name:'微信退款:{$refund_money_7}元'},
                </if>
            ]
        }
    ]
};
echarts.init(document.getElementById('space_pie_2')).setOption(space_option_2);

//支付流水统计
var space_option_3 = {
	title : {
		text: '支付流水统计',
		subtext: ''
	},
	tooltip : {
		trigger: 'axis',
	},
	legend: {
		selectedMode: false,
		data:['会员卡支付', '券支付', '支付宝支付', '微信支付']
	},
	xAxis : [
		{
			type : 'category',
			rotate: 60,
			axisLabel : {
				rotate:45,
			},

			data : [<php>$data_arr = array(); foreach($pay_day_list as $value) $data_arr[] = '"'.$value[day].'"'; echo implode(',', $data_arr);</php>]
		}
	],
	yAxis : [
		{
			type : 'value',
			axisLabel : {
				formatter: '{value} 次'
			}
		}
	],
	series : [
		{
			name:'会员卡支付',
			type:'line',
			axisTick:true,
			data:[<php>$data_arr = array(); foreach($pay_day_list as $value) $data_arr[] = $value[pay_money_4]; echo implode(',', $data_arr);</php>],
		},
		{
			name:'券支付',
			type:'line',
			axisTick:true,
			data:[<php>$data_arr = array(); foreach($pay_day_list as $value) $data_arr[] = $value[pay_money_5]; echo implode(',', $data_arr);</php>],
		},
		{
			name:'支付宝支付',
			type:'line',
			axisTick:true,
			data:[<php>$data_arr = array(); foreach($pay_day_list as $value) $data_arr[] = $value[pay_money_6]; echo implode(',', $data_arr);</php>],
		},
		{
			name:'微信支付',
			type:'line',
			axisTick:true,
			data:[<php>$data_arr = array(); foreach($pay_day_list as $value) $data_arr[] = $value[pay_money_7]; echo implode(',', $data_arr);</php>],
		}
	]
};
echarts.init(document.getElementById('space_line_1')).setOption(space_option_3);

//影院收入统计
var space_option_4 = {
	title : {
		text: '影院收入统计',
		subtext: ''
	},
	tooltip : {
		trigger: 'axis',
	},
	xAxis : [
		{
			type : 'category',
			rotate: 30,
			axisLabel : {
				rotate:25,
			},

			data : [<php>$data_arr = array(); foreach($cinema_host_list as $key => $value) { $data_arr[] = '"'.$value[cinema_name].'"'; if(9 == $key) break; } echo implode(',', $data_arr);</php>]
		}
	],
	yAxis : [
		{
			type : 'value',
			axisLabel : {
				formatter: '{value}'
			}
		}
	],
	series : [
		{
			name:'收入',
			type:'bar',
			axisTick:true,
			data:[<php>$data_arr = array(); foreach($cinema_host_list as $key => $value) { $data_arr[] = $value[income]; if(9 == $key) break; } echo implode(',', $data_arr);</php>],
		}
	]
};
echarts.init(document.getElementById('space_bar_1')).setOption(space_option_4);

function clearFilter()
{
	$('#create_time_start').val('');
	$('#create_time_end').val('');
	$('#mutil_level_data_1_id_1').val(0);
	$('#mutil_level_data_1_id_2').val(0);
	$('#mutil_level_data_1_id_3').val(0);
	document.data_form.submit();
}

$(document).ready(function(){
	//清理查询条件
	var mutil_level_data_1_id_1 = {$area_1};
	var mutil_level_data_1_id_2 = {$area_2};
	var mutil_level_data_1_id_3 = {$area_3};
	if (!mutil_level_data_1_id_1) {
		$('#mutil_level_data_1_id_2').hide();
	}
	if (!mutil_level_data_1_id_2) {
		var mutil_level_data_1_id_2_option = $('#mutil_level_data_1_id_2').html();
		mutil_level_data_1_id_2_option = '<option value="0"></option>'+mutil_level_data_1_id_2_option;
		$('#mutil_level_data_1_id_2').html(mutil_level_data_1_id_2_option);
		$('#mutil_level_data_1_id_3').hide();
	}
	if (!mutil_level_data_1_id_3) {
		var mutil_level_data_1_id_3_option = $('#mutil_level_data_1_id_3').html();
		mutil_level_data_1_id_3_option = '<option value="0"></option>'+mutil_level_data_1_id_3_option;
		$('#mutil_level_data_1_id_3').html(mutil_level_data_1_id_3_option);
	}
});
</script>